package com.zzx;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.List;

import org.junit.Test;

public class ProxyDemo {

	@Test
	public void one() throws Exception {
		Class<?>[] interfaces = {List.class};
		InvocationHandler h = new InvocationHandler() {
			
			@Override
			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
				System.out.println("不光你调用什么方法，我都是这一套");
				return null;
			}
		};
	List list = (List) Proxy.newProxyInstance(ProxyDemo.class.getClassLoader(), interfaces, h);
		
	System.out.println(list instanceof List);
//	list.add(123);
	
	
	}
	
}
